<template>
  <div class="startgroup">
    <header>
      <p>
        <router-link to="/group">《——</router-link>
      </p>
      <p>开团</p>
      <p>
        <span>...</span>
        <span>o</span>
      </p>
    </header>
    <main>
      <dl>
        <dt>
          <img :src="info.img" alt />
        </dt>
        <dd>
          <h1>{{info.name}}</h1>
          <h2>{{info.area}}</h2>
          <h3>{{info.newtime}}</h3>
          <h2>团购简绍</h2>
          <p>团购简绍团购简绍团购简绍团购简绍团购简绍团购简绍团购简绍团购简绍团购简绍团购简绍团购简绍</p>
          <h2>集合地址</h2>
          <input type="text" placeholder="输入集合地址" v-model="userObj.name" />
          <h2>车辆牌号</h2>
          <input type="text" placeholder="输入车辆牌号" v-model="userObj.area" />

          <h2>集合时间</h2>
          <input type="text" placeholder="输入集合时间" v-model="userObj.newtime" />

          <button class="button" @click="open()">开团</button>
        </dd>
      </dl>
    </main>
  </div>
</template>

<script>
// import { tableData2 } from "@/api/index";
import axios from "axios";

export default {
  name: "index",

  data() {
    return {
      info: [],
      userObj: {
        img:
          "https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00418-2745.jpg",
        name: "",
        area: "",
        newtime: "",
        // number:'',
        // myname:"",
        // state:"",
        id: Math.random() * 100
      }
    };
  },
  created() {
    this.id = this.$route.params.id;
    //调用函数、
    this.getList();
  },
  methods: {
    //获取详情数据
    getList() {
      axios({
        url: "/api/Detail2",
        method: "post",
        data: {
          id: this.id
        }
      }).then(res => {
        this.info = res.data.data;
      });
    },

    open() {
      // this.$store.dispatch('',{name:this.name,area:this.area,newtime:this.newtime})
      axios({
        url: "/api/insert",
        method: "post",
        data: { userObj: this.userObj }
      }).then(res => {
        this.tableData2 = res.data.data;
      }),
        this.$router.go(-1);
    }
  }
};
</script>


<style lang="scss" scoped>
.startgroup {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  header {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 60px;
    background-color: rgb(34, 100, 177);
    color: #fff;

    p:first-child {
      a {
        color: #fff;
      }
    }
    p:nth-child(3) {
      border: 1px solid rgb(226, 226, 226);
      width: 60px;
      height: 26px;
      border-radius: 26px;
      display: flex;
      align-items: center;
      justify-content: space-around;
    }
  }

  main {
    flex: 1;
    overflow-y: scroll;

    dl {
      width: 100%;
      height: 100%;
      dt {
        width: 100%;
        height: 200px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      dd {
        margin-left: 5%;
        width: 90%;
        input {
          width: 60%;
          height: 40px;
        }
        button {
          margin-left: 40px;
          width: 80px;
          height: 40px;
          background-color: rgb(98, 192, 221);
        }
      }
    }
  }
}
</style>